package com.jinke.api.modules.ums.controller;

import com.jinke.api.common.api.CommonResult;
import com.jinke.api.modules.ums.model.ChannelPlatform;
import com.jinke.api.modules.ums.service.ChannelPlatformService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "承运商平台")
@RestController
@RequestMapping("/admin/channelPlatform")
@RequiredArgsConstructor
public class ChannelPlatformController {
    private final ChannelPlatformService channelPlatformService;

    @ApiOperation("所有数据")
    @GetMapping
    public CommonResult<List<ChannelPlatform>> listAll(){
        return CommonResult.success(
                channelPlatformService.lambdaQuery()
                        .select(ChannelPlatform::getId, ChannelPlatform::getChannelPlatformName)
                        .orderByDesc(ChannelPlatform::getId).list()
        );
    }
}
